package com.example.userconsumer.controller;

import com.example.userconsumer.service.UserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author TonySong
 * @date 2024/4/22 0022
 * @time 14:40
 */
@RestController
@Slf4j
public class UserConsumer {


    @Value("${server.port}")
    private Integer port;


    //@Resource
    @Autowired
    private RestTemplate restTemplate;

    @Resource
    private UserService userService;
    @GetMapping("/hi")
    public String index(){
//       String path ="http://localhost:8001/list";
//        String value = this.restTemplate.getForObject(path, String.class);
        String value = this.userService.haha();

        return "hi,i am from port:"+port+"--->"+value;
    }
}
